<?php require_once('../Connections/elevate954.php'); ?>
<?php require_once("../webassist/database_management/wa_appbuilder_php.php"); ?>
<?php require_once( "../webassist/security_assist/helper_php.php" ); ?>
<?php
if (!WA_Auth_RulePasses("Logged in to ADMIN_SETTINGS")){
	WA_Auth_RestrictAccess("../login_admin.php");
}
?>
<?php
mysql_select_db($database_elevate954, $elevate954);
$query_WADAMenumenu_id = "SELECT NAME, menu_id FROM menu_cat";
$WADAMenumenu_id = mysql_query($query_WADAMenumenu_id, $elevate954) or die(mysql_error());
$row_WADAMenumenu_id = mysql_fetch_assoc($WADAMenumenu_id);
$totalRows_WADAMenumenu_id = mysql_num_rows($WADAMenumenu_id);
?>
<?php
mysql_select_db($database_elevate954, $elevate954);
$query_WADAMenupages_id = "SELECT PAGE_NAME, pages_id FROM pages";
$WADAMenupages_id = mysql_query($query_WADAMenupages_id, $elevate954) or die(mysql_error());
$row_WADAMenupages_id = mysql_fetch_assoc($WADAMenupages_id);
$totalRows_WADAMenupages_id = mysql_num_rows($WADAMenupages_id);
?>
<?php 
// WA DataAssist Insert
if (isset($_POST["Insert"]) || isset($_POST["Insert_x"])) // Trigger
{
  $WA_connection = $elevate954;
  $WA_table = "submenu_cat";
  $WA_sessionName = "WADA_Insert_submenu_cat";
  $WA_redirectURL = "submenu_cat_results?submenu_id=[Insert_ID]";
  if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
  $WA_keepQueryString = false;
  $WA_fieldNamesStr = "submenu_id|SUB_MENU_NAME|menu_id|REDIRECT_STATUS|WEB_REDIRECT|pages_id|SORT_ORDER";
  $WA_fieldValuesStr = "".((isset($_POST["submenu_id"]))?$_POST["submenu_id"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["SUB_MENU_NAME"]))?$_POST["SUB_MENU_NAME"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["menu_id"]))?$_POST["menu_id"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["REDIRECT_STATUS"]))?$_POST["REDIRECT_STATUS"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["WEB_REDIRECT"]))?$_POST["WEB_REDIRECT"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["pages_id"]))?$_POST["pages_id"]:"")  ."" . $WA_AB_Split . "".((isset($_POST["SORT_ORDER"]))?$_POST["SORT_ORDER"]:"")  ."";
  $WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";
  $WA_fieldNames = explode("|", $WA_fieldNamesStr);
  $WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
  $WA_columns = explode("|", $WA_columnTypesStr);
  $WA_connectionDB = $database_elevate954;
  mysql_select_db($WA_connectionDB, $WA_connection);
  @session_start();
  $insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
  $WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
  $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
  $_SESSION[$WA_sessionName] = mysql_insert_id($WA_connection);
  if ($WA_redirectURL != "")  {
    $WA_redirectURL = str_replace("[Insert_ID]",$_SESSION[$WA_sessionName],$WA_redirectURL);
    if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
      $WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
    }
    header("Location: ".$WA_redirectURL);
  }
}
?>
<!doctype html>
<html><!-- InstanceBegin template="/Templates/ADMIN BACKEND.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset="utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<link rel="stylesheet" type="text/css" href="style/style.css" />
	<link rel="stylesheet" type="text/css" href="style/fluid.css" title="fluid" media="screen" />
        
	<title>Chameleon Circuit | Admin Panel from Themio</title>
        <script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>

        <script type="text/javascript" src="js/excanvas.min.js"></script>
        <script type="text/javascript" src="js/jquery.flot.min.js"></script>
        <script type="text/javascript" src="js/jquery.flot.pie.min.js"></script>
        <script type="text/javascript" src="js/jquery.flot.stack.min.js"></script>

        <script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
        <script type="text/javascript" src="js/jquery.labelify.js"></script>
        <script type="text/javascript" src="js/iphone-style-checkboxes.js"></script>
        <script type="text/javascript" src="js/jquery.ui.selectmenu.js"></script>
        <script type="text/javascript" src="js/vanadium-min.js"></script>
        <script type="text/javascript" src="js/jquery.cleditor.min.js"></script>
        <script type="text/javascript" src="js/superfish.js"></script>
        <script type="text/javascript" src="js/jquery.colorbox-min.js"></script>
        <script type="text/javascript" src="js/styleswitch.js"></script>

        <script type="text/javascript" src="js/fullcalendar.min.js"></script>
        <script type="text/javascript" src="js/jquery.uploadify.v2.1.4.min.js"></script>
        <script type="text/javascript" src="js/uploadify.js"></script>
        <script type="text/javascript" src="js/jquery.tipsy.js"></script>

        <script type="text/javascript" src="js/gcal.js"></script>
        <script type="text/javascript" src="js/swfobject.js"></script>
        <script type="text/javascript" src="js/jquery.pnotify.min.js"></script>
        <script type="text/javascript" src="js/examples.js"></script>

        <script type="text/javascript" src="js/sidemenu.js">// Strictly for sidebar </script>

        <!-- Toolbar for Demo Only -->
        <link rel="stylesheet" type="text/css" href="demo/toolbar.css" />
        <link rel="stylesheet" media="screen" type="text/css" href="demo/colorpicker/css/colorpicker.css" />
        <style type="text/css">
        .bodyarea_admin {
	width: 100%;
	margin: 10px
}
        </style>
        <script type="text/javascript" src="demo/colorpicker/js/colorpicker.js"></script>
        <!-- Demo js Only -->
        <script type="text/javascript" src="js/demo.js"></script>
        <!-- InstanceBeginEditable name="head" -->


<script src="../webassist/progress_bar/jquery-blockui-formprocessing.js" type="text/javascript"></script>
<link href="../webassist/forms/fd_basic_default.css" rel="stylesheet" type="text/css">
<link href="../webassist/forms/dataassist_button.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
</head>


<body>
<?php include("s_header.php"); ?>
    <div class="grid_16 widget first">
        <div class="widget_title clearfix">
            <h2>&nbsp;</h2>
        </div>
        <div class="widget_body">
          <div class="widget_content">
          </div>
            <div class="bodyarea_admin" id="bodyarea_admin"><!-- InstanceBeginEditable name="BODY_AREA" -->
<div id="Insert_Basic_Default_ProgressWrapper">
  <form class="Basic_Default" id="Insert_Basic_Default" name="Insert_Basic_Default" method="post" action="<?php echo (htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?>">
    <fieldset class="Basic_Default" id="Insert">
      <legend class="groupHeader">Insert</legend>
      <div class="lineGroup">
        
        <div class="errorGroup"> <span>
          <input id="submenu_id" name="submenu_id" type="hidden" value="<?php echo((isset($_GET["invalid"])?ValidatedField("submenucatinsert","submenu_id"):"")); ?>" class="formTextfield_Medium" tabindex="1">
        </span> </div>
      </div>
      <div class="lineGroup">
        <label for="SUB_MENU_NAME" class="sublabel" > SUB MENU NAME:</label>
        <div class="errorGroup"> <span>
          <input id="SUB_MENU_NAME" name="SUB_MENU_NAME" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("submenucatinsert","SUB_MENU_NAME"):"")); ?>" class="formTextfield_Medium" tabindex="2">
        </span> </div>
      </div>
      <div class="lineGroup">
        <label for="menu_id" class="sublabel" > PARENT MENU:</label>
        <div class="errorGroup"> <span>
          <select class="formMenufield_Medium" name="menu_id" id="menu_id" tabindex="3">
            <?php
do {  
?>
            <option value="<?php echo $row_WADAMenumenu_id['menu_id']?>"<?php if (!(strcmp($row_WADAMenumenu_id['menu_id'], (isset($_GET["invalid"])?ValidatedField("submenucatinsert","menu_id"):"")))) {echo "selected=\"selected\"";} ?>><?php echo $row_WADAMenumenu_id['NAME']?></option>
            <?php
} while ($row_WADAMenumenu_id = mysql_fetch_assoc($WADAMenumenu_id));
  $rows = mysql_num_rows($WADAMenumenu_id);
  if($rows > 0) {
      mysql_data_seek($WADAMenumenu_id, 0);
	  $row_WADAMenumenu_id = mysql_fetch_assoc($WADAMenumenu_id);
  }
?>
          </select>
        </span> </div>
      </div>
      <div class="lineGroup">
        <label for="REDIRECT_STATUS" class="sublabel" > REDIRECT_STATUS:</label>
        <div class="errorGroup"> <span>
          <select class="formMenufield_Medium" name="REDIRECT_STATUS" id="REDIRECT_STATUS" tabindex="4">
            <option value="YES">YES</option>
            <option value="NO" selected="selected">NO</option>
          </select>
        </span> </div>
      </div>
      <div class="lineGroup">
        <label for="WEB_REDIRECT" class="sublabel" > WEB_REDIRECT:</label>
        <div class="errorGroup"> <span>
          <input id="WEB_REDIRECT" name="WEB_REDIRECT" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("submenucatinsert","WEB_REDIRECT"):"")); ?>" class="formTextfield_Medium" tabindex="5">
        </span> </div>
      </div>
      <div class="lineGroup">
        <label for="pages_id" class="sublabel" > PARENT PAGE:</label>
        <div class="errorGroup"> <span>
          <select class="formMenufield_Medium" name="pages_id" id="pages_id" tabindex="6">
            <option value="">STANDALONE PAGE</option>
            <?php
do {  
?>
            <option value="<?php echo $row_WADAMenupages_id['pages_id']?>"<?php if (!(strcmp($row_WADAMenupages_id['pages_id'], (isset($_GET["invalid"])?ValidatedField("submenucatinsert","pages_id"):"")))) {echo "selected=\"selected\"";} ?>><?php echo $row_WADAMenupages_id['PAGE_NAME']?></option>
            <?php
} while ($row_WADAMenupages_id = mysql_fetch_assoc($WADAMenupages_id));
  $rows = mysql_num_rows($WADAMenupages_id);
  if($rows > 0) {
      mysql_data_seek($WADAMenupages_id, 0);
	  $row_WADAMenupages_id = mysql_fetch_assoc($WADAMenupages_id);
  }
?>
          </select>
        </span> </div>
      </div>
      <div class="lineGroup">
        <label for="SORT_ORDER" class="sublabel" > SORT_ORDER:</label>
        <div class="errorGroup"> <span>
          <input id="SORT_ORDER" name="SORT_ORDER" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("submenucatinsert","SORT_ORDER"):"")); ?>" class="formTextfield_Medium" tabindex="7">
        </span> </div>
      </div>
      <span class="buttonFieldGroup" >
      <input type="submit" value="Insert" class="formButton" id="Insert" name="Insert" />
      </span>
    </fieldset>
  </form>
</div>
<div id="Insert_Basic_Default_ProgressMessageWrapper" class="blockUIOverlay" style="display:none;">
  <script type="text/javascript">
WADFP_SetProgressToForm('Insert_Basic_Default', 'Insert_Basic_Default_ProgressMessageWrapper', WADFP_Theme_Options['BigSpin:Slate']);
  </script>
  <div id="Insert_Basic_Default_ProgressMessage" >
    <p style="margin:10px; padding:5px;" ><img src="../webassist/progress_bar/images/slate-largespin.gif" alt="" title="" style="vertical-align:middle;" />&nbsp;&nbsp;Please wait</p>
  </div>
</div>
<!-- InstanceEndEditable --></div>
        </div>
        </div>
    </div>
    <!--
<div id="dialog" title="Hello, Hello, Twisted Transistor">
	<p>Chameleon Circuit features unlimited color schemes. Try moving the color sliders on the top right corner of your screen and see how you would like YOUR theme to be!</p>
</div>
-->
<?php include("footer.php") ?>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($WADAMenumenu_id);
?>
<?php
mysql_free_result($WADAMenupages_id);
?>
